import axiosInstance from '@/request/axios-config'

// 查询角色选择列表
export const selectListRoleService = () => {
    return axiosInstance.get('/role/roleSelectList')
}

// 分页带条件查询所有角色
export const pageListService = (param: any) => {
    return axiosInstance.post('/role/pageList', param)
}

// 新增角色
export const addRoleService = (data: any) => {
    return axiosInstance.post('/role/add', data)
}


// 获取角色信息和menuIds
export const getRoleAndmenuIds = (userId: any) => {
    return axiosInstance.get('/role/getRoleAndMenuIdsById', {
        params: {id: userId}
    })
}

// 修改角色
export const updateRoleService = (data: any) => {
   return axiosInstance.put('/role/edit', data)
}

// 删除角色
export const deleteRoleByIds = (ids: any) => {
    return axiosInstance.post('/role/delete/', ids)
}

// 修改可用状态
export const updateRoleStatusByIds = (param: any) =>{
    return axiosInstance.put('/role/updateStatus/', param)
}

// 查询权限分配和未分配菜单树
export const searchAuthAndNot = (roleId: any) => {
    return axiosInstance.get('/role/searchAuthAndNot', {
        params: {roleId: roleId}
    })
}
